# Replication Package: Demographic Structure and Global Capital Allocation

**Author:** Brian Peters
**Date:** March 2026
**Contact:** [your email]

---

## Overview

This dataset provides replication materials for a 20-paper research series investigating how population age structure reshapes international capital flows, asset prices, fiscal sustainability, monetary transmission, and macro-financial risk. The series uses a 140-country panel (1970-2024, ~97% of world population) with demographic principal components (Z1, Z2, Z3) from the UN World Population Prospects as the core explanatory variables.

All papers share a common estimation framework (PanelGLS with Prais-Winsten AR(1) correction) and are designed to replicate independently from the materials provided.

## Software Requirements

- Python 3.10 or higher
- Required packages: `numpy`, `pandas`, `statsmodels`, `scipy`, `matplotlib`, `wbgapi`, `imfp`, `requests`, `python-docx`
- Install: `pip install numpy pandas statsmodels scipy matplotlib wbgapi imfp requests python-docx`
- Some scripts require a FRED API key (free from https://fred.stlouisfed.org/docs/api/api_key.html)

## Directory Structure

```
dataverse_upload/
  README.md                          # This file
  shared_code/
    model.py                         # PanelGLS estimator (used by all papers)
  paper_01_multilateral_140/         # Paper 1: Demographics and Current Accounts (140 Countries)
  paper_02_gravity_bilateral/        # Paper 2: Bilateral Gravity Model
  paper_03_causal_identification/    # Paper 3: Causal Identification
  paper_04_twin_deficits/            # Paper 4: Fiscal Leverage and Twin Deficits
  paper_05_feldstein_horioka/        # Paper 5: Savings Retention (FH Correlations)
  paper_06_asset_returns/            # Paper 6: Asset Prices (Murder-Suicide of the Rentier)
  paper_07_cca_tipping/              # Paper 7: Capital Account Tipping Point
  paper_08_capital_deepening/        # Paper 8: Capital Deepening and J-Curve
  paper_09_automation/               # Paper 9: Investment and Automation
  paper_10_trilemma/                 # Paper 10: Demographics and the Trilemma
  paper_11_japanification/           # Paper 11: Demographics and Japanification
  paper_12_fiscal_dominance/         # Paper 12: Fiscal Sustainability Trap
  paper_13_crises/                   # Paper 13: Financial Crises Early Warning
  paper_14_monetary/                 # Paper 14: Monetary Policy Transmission
  paper_15_net_gross/                # Paper 15: Net vs Gross External Adjustment
  paper_16_safe_assets/              # Paper 16: Safe Asset Scarcity
  paper_17_safe_asset_cliff/         # Paper 17: The Safe Asset Cliff
  paper_18_nonlinear_capstone/       # Paper 18: Nonlinear Framework (Capstone)
  paper_19_fragility/                # Paper 19: Sample Composition Fragility
  paper_20_doom_loop/                # Paper 20: Demographic Regulatory Doom Loop
```

Each paper directory contains:
- `REPLICATION_README.md` — Paper-specific replication instructions
- `scripts/` — Numbered phase scripts (run in order: phase1, phase2, ...)
- `src/` — Source modules (including PanelGLS estimator)
- `data/processed/` — Processed panel datasets (CSV)
- `output/tables/` — Regression results and summary statistics (CSV)
- `paper/` — Manuscript source (Markdown)

## Paper Index

| # | Title | Key Finding |
|---|-------|-------------|
| 1 | Demographic Structure and International Capital Flows | Z1 predicts CA/GDP (beta = -1.62, p < 0.001) across 140 countries |
| 2 | Where Does Demographic Capital Go? Bilateral Gravity | Demographic divergence (dZ1) drives bilateral flows in CPIS data |
| 3 | Does Demography Cause Capital Flows? | Predetermined demographics (20yr lag) confirm causal direction |
| 4 | Demographic Erosion of Fiscal Leverage: Twin Deficits | Aging weakens fiscal-CA transmission (3.3:1 expenditure-revenue asymmetry) |
| 5 | Why FH Correlations Vary | Demographics explain cross-country variation in savings retention |
| 6 | Demographics and Asset Prices | Z1 predicts equity returns (-8.94, p < 0.001), bond yields, housing |
| 7 | The CCA Tipping Point | Capital account opening above threshold amplifies demographic flows |
| 8 | Does Demographic Capital Do Anything? | Capital deepening follows demographic inflows with J-curve dynamics |
| 9 | Demographics, Investment, and Capital Deepening | Aging shifts investment composition toward automation |
| 10 | Demographics and the Trilemma | Eurozone amplifies demographic CA imbalances 18x vs OECD floaters |
| 11 | Demographics and Japanification | Z1 predicts zero-rate episodes; post-GFC structural break in transmission |
| 12 | Population Aging and the Fiscal Sustainability Trap | Aging drives expenditure 3.3x faster than revenue |
| 13 | Demographics and Financial Crises | Z1 enters EWS models; aging predicts banking crisis probability |
| 14 | Demographics and Monetary Policy Transmission | Aging attenuates monetary policy effectiveness |
| 15 | Net vs Gross External Adjustment | Demographics drive net positions; gross flows follow different logic |
| 16 | Demographic Divergence and Safe Asset Scarcity | Aging creditors drive safe asset demand; supply concentrates in fewer issuers |
| 17 | The Safe Asset Cliff | Fiscal-demographic pressure erodes safe-issuer status (US 64% survival) |
| 18 | When Does Demography Move Capital? | Nonlinear thresholds: financial openness, income, institutions gate transmission |
| 19 | Sample Composition Fragility | Systematic robustness framework for demographic-CA results |
| 20 | The Demographic Regulatory Doom Loop | Aging creates circular fiscal-financial feedback (doom loop score framework) |

## Data Sources

All underlying data comes from publicly available sources:

- **UN World Population Prospects (2024 Revision)** — Age distributions for demographic PCA (Z1, Z2, Z3)
- **IMF World Economic Outlook** — Current account, GDP, fiscal balance
- **Penn World Table 10.01** — Capital stock (rnna), output-side real GDP, employment
- **IMF International Financial Statistics** — Interest rates, exchange rates
- **Chinn-Ito KAOPEN Index** — Capital account openness
- **Lane-Milesi-Ferretti EWN** — Net foreign assets
- **CPIS (IMF)** — Bilateral portfolio holdings (Paper 2)
- **World Bank WDI** — Resource rents, institutional indicators
- **FRED (St. Louis Fed)** — US Treasury yields, additional rate series

## Estimation Framework

All papers use the PanelGLS estimator (`shared_code/model.py`):
- Pooled GLS with Prais-Winsten AR(1) correction for serial correlation
- Country-clustered standard errors
- Standard controls: fiscal balance/GDP, lagged NFA/GDP, real GDP growth, log relative output per worker, capital account openness (KAOPEN)
- Robustness battery: year FE, two-way FE, predetermined demographics, OECD/non-OECD splits, cluster bootstrap, permutation tests

## Replication Instructions

Each paper can be replicated independently:

1. Navigate to the paper directory (e.g., `paper_01_multilateral_140/`)
2. Read `REPLICATION_README.md` for paper-specific instructions
3. Install Python dependencies (see Software Requirements above)
4. Run scripts in phase order: `python3 scripts/phase1_*.py`, then `phase2_*.py`, etc.
5. Compare output in `output/tables/` against published results

**Note on paths:** Scripts were originally written with absolute paths (`/mnt/c/demographics_capital_flows/...`). For standalone replication, you may need to update the path references at the top of each script to point to your local directory.

## Key Variables

| Variable | Description | Source |
|----------|-------------|--------|
| Z1, Z2, Z3 | Principal components of national age distribution | UN WPP via Fair-Dominguez (1998) / Higgins (1998) polynomial decomposition |
| ca_gdp | Current account balance (% GDP) | IMF WEO |
| fiscal_bal_gdp | Fiscal balance (% GDP), winsorized p1/p99 | IMF WEO |
| nfa_gdp_lag | Net foreign assets (% GDP), lagged | Lane-Milesi-Ferretti |
| rgdp_growth | Real GDP growth rate | IMF WEO |
| log_rel_opw | Log relative output per worker | PWT 10.01 |
| kaopen | Chinn-Ito capital account openness index | Chinn-Ito |
| oadr | Old-age dependency ratio (65+/15-64) | UN WPP |

## Citation

If you use these data or code, please cite:

Peters, Brian. 2026. "Demographic Structure and Global Capital Allocation: Replication Data and Code." Harvard Dataverse. https://doi.org/[DOI].

Individual papers should be cited separately — see each paper's manuscript in the `paper/` subdirectory.

## License

Code: MIT License
Data: CC BY 4.0 (derived from publicly available sources listed above)
